const inputName = document.querySelector('#inputName')
const inputPrice = document.querySelector('#inputPrice')
const inputNum = document.querySelector('#inputNum')
const btnAdd = document.querySelector('#btn-add')

btnAdd.addEventListener('click', function() {
	const name = inputName.value,
		  price = inputPrice.value,
		  num = inputNum.value
		  utils.fetch('./api/shop/add.php', {name, price, num}).then(resp => {
			  if (resp.code ===200) {
				  $('#addModal').modal('hide')
				  getData()
			  }else{
				  alert(resp.body.msg)
			  }
		  })
})
$('#addModal').on('hidden.bs.modal', function(e) {
	inputName.value = inputPrice.value = inputPrice.value = inputNum.value = ''
})